package cn.dapeng.lambda;


import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;

public class SortBO {

    private int id;

    private int type;

    public int getId() {
        return id;
    }

    public int getType() {
        return type;
    }

    public void setId(int id) {
        this.id = id;
    }

    public void setType(int type) {
        this.type = type;
    }

    public static void main(String[] args) {

        int times = 20;

        List<SortBO> list = new ArrayList<>(times);
        for (int i = 0; i < times; i++) {
            SortBO r = new SortBO();
            r.setId(i);
            r.setType(i % 2);
            list.add(r);
        }

        Map<Integer, List<SortBO>> o = list.stream().collect(Collectors.groupingBy(SortBO::getType));

        System.out.println(o);

    }

}
